﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;

namespace RaProWorld
{
    class SubMenuButton
    {
        public Texture2D sprite;
        public Vector2 position;
        public int countdown;
        public float zoom;
        public bool active;

        public SubMenuButton(Texture2D newSprite,Vector2 newPosition) 
        {
            sprite = newSprite;
            position = newPosition;
            zoom = 1.0f;
            active = false;
            countdown = 5;

        }
        public void Update() 
        {
            if (active)
            {
                zoom= (float)((5.0f-countdown)*0.2f)*0.25f+1.0f;
                if (countdown != 0) 
                {
                    countdown--;
                }
            }
            else 
            {
                zoom = 1.0f;
                countdown = 5;
            }
        }

        public void Draw(SpriteBatch spriteBatch) 
        {
            spriteBatch.Draw(sprite,
                position,
                null,
                new Color(255.0f, 255.0f, 255.0f, 1.0f),
                0.0f,
                new Vector2(sprite.Width / 2, sprite.Height / 2),
                zoom,
                SpriteEffects.None,
                0.0f);
        }
    }
}
